<template>
	<view>
		<button type="default" size="mini" @click="handleCount(-1)">-</button>
		  <text class="count">{{count}}</text> 
		<button  size="mini" type="default" @click="handleCount(1)">+</button>
	</view>
</template>

<script>
	export default {
		/* 组件里面的生命周期推荐是 vue的 */
		name:"counter",
		props:{
			count:Number
		},
		methods:{
			handleCount(type){
				this.$emit("oncount",type)
			}
		},
		data() {
			return {
				
			};
		}
	}
</script>

<style lang="scss">
    .count{
		color: $uni-color-success;
	}
</style>
